<template>
  <div class="app-container">
    <el-card>
      <el-form :model="auditList" :inline="true" label-width="68px">
        <el-form-item label="操作人" prop="operatorName">
          <el-input v-model="auditList.operatorName" placeholder="请输入操作人姓名"></el-input>
        </el-form-item>
        <el-form-item label="商品id" prop="pkMaterial">
          <el-input v-model="auditList.pkMaterial" placeholder="请输入商品id"></el-input>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" icon="el-icon-search" v-hasPermi="['organize:audit:query']" @click="getAuditList">查询</el-button>
          <el-button type="danger" icon="el-icon-refresh" @click="clearVerify">重置</el-button>
        </el-form-item>
      </el-form>
    </el-card>
    <el-card>
      <el-table :data="getAudit" border height="605px">
        <el-table-column prop="oldValue" label="原来的值" align="center"></el-table-column>
        <el-table-column prop="newValue" label="新的值" align="center"></el-table-column>
        <el-table-column  label="修改类型" align="center">
          <template template slot-scope="scope">
            <span v-if="scope.row.type == 0">有效期</span>
            <span v-if="scope.row.type == 1">复验期</span>
            <span v-if="scope.row.type == 2">物料状态</span>
            <span v-if="scope.row.type == 3">移位</span>
          </template>
        </el-table-column>
        <el-table-column prop="operatorName" label="操作人姓名" align="center"></el-table-column>
      </el-table>
      <el-pagination background layout=" total,prev, pager, next, sizes,jumper" @size-change="handleSizeChange"
        @current-change="handleCurrentChange" :current-page="auditList.pageNum" :page-size="auditList.pageSize"
        :page-sizes="[10, 20, 50, 100]" :total="total">
      </el-pagination>
    </el-card>
  </div>
</template>

<script>
  import {
    findQaHistoryList
  } from '@/api/organize/index.js'
  export default {
    data() {
      return {
        total: 0,
        auditList: {
          operatorName: '',
          pkMaterial: ''
        },
        getAudit: []
      }
    },
    created() {
      this.getAuditList();
    },
    methods: {
      //重置数据
      clearVerify(){
        this.auditList.operatorName = '';
        this.auditList.pkMaterial = '';
        this.getAuditList();
      },
      //查询数据
      getAuditList() {
        findQaHistoryList(this.auditList).then(res => {
          this.getAudit = res.rows;
          this.total = res.total;
        })
      },
      //分页
      handleSizeChange(newsize) {
        this.auditList.pageNum = 1
        this.auditList.pageSize = newsize
        this.getAuditList()
      },
      handleCurrentChange(newpage) {
        this.auditList.pageNum = newpage
        this.getAuditList()
      },

    }
  }
</script>

<style scoped lang="scss">
  .app-container {
    padding: 20px;
  }

  .el-card {
    margin-bottom: 20px;
  }

  .el-pagination {
    float: right;
    margin: 20px;
  }
</style>
